//
//  HZNavView.m
//  微博 OC
//
//  Created by 黑眼圈 on 16/4/21.
//  Copyright © 2016年 heiyan. All rights reserved.
//

#import "HZNavView.h"

@interface HZNavView()

@property (weak, nonatomic) IBOutlet UIButton *cancel;

@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tralied;

@end

@implementation HZNavView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (IBAction)cancle:(id)sender {
    
    //约束动画
    self.tralied.constant = 0;
    
    [UIView animateWithDuration:0.3 animations:^{
        
        [self layoutIfNeeded];
    }];
    
    //取消编辑框的编辑模式
    [self.textField resignFirstResponder];
    
}

- (IBAction)editingBegin:(id)sender {
    
    //约束动画
    self.tralied.constant = 44;
    
    [UIView animateWithDuration:0.3 animations:^{
        
        [self layoutIfNeeded];
    }];
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self = [[NSBundle mainBundle]loadNibNamed:@"HZNavigationBar" owner:nil options:nil].lastObject;
        
        
        self.textField.layer.cornerRadius = 5;
        self.textField.layer.masksToBounds = YES;
        self.textField.layer.borderWidth = 3;
        self.textField.layer.borderColor = [UIColor redColor].CGColor;
    }
    return self;
}


@end
